package com.eff.android.lib.ui;

import com.eff.android.lib.R;

import android.content.Context;
import android.graphics.Bitmap;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

public class EImageView extends LinearLayout{

	private ImageView img;
	private TextView wordText;
	
	private String word;
	private Bitmap bitmap;
	
	public void SetAlpha(float ap)
	{
		img.setAlpha(0.0f);
		wordText.setAlpha(0.0f);
		this.invalidate();
	}
	
	public EImageView(Context context, AttributeSet attrs) {
		super(context, attrs);
		initViews(context);
	}

	private void initViews(Context context) {
		LayoutInflater inflater = (LayoutInflater) context
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

		inflater.inflate(R.layout.e_image_view, this);
		setImg((ImageView)findViewById(R.id.imgCustomView));
		setWordText((TextView)findViewById(R.id.wordTextView));
	}

	public EImageView(Context context) {
		super(context);
		initViews(context);
	}

	public EImageView(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
		initViews(context);
	}
	
	public EImageView(Context context, String word, Bitmap bitmap){
		super(context);
		this.setWord(word);
		this.setBitmap(bitmap);
		initViews(context);
	}
	
	public void setText(String word){
		this.getWordText().setText(word);
	}
	
	public void setImage(Bitmap bitmap){
		this.getImg().setImageBitmap(bitmap);
	}

	public String getWord() {
		return word;
	}

	public void setWord(String word) {
		this.word = word;
	}

	public Bitmap getBitmap() {
		return bitmap;
	}

	public void setBitmap(Bitmap bitmap) {
		this.bitmap = bitmap;
	}

	public ImageView getImg() {
		return img;
	}

	public void setImg(ImageView img) {
		this.img = img;
	}

	public TextView getWordText() {
		return wordText;
	}

	public void setWordText(TextView wordText) {
		this.wordText = wordText;
	}

}
